<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Linkslistsstyles extends Model
{
    protected $table = 'links_lists_styles';
    protected $primaryKey = 'id';

    public static function getLinksListsStyles($links_id)
    {
        return self::select("style","logo","button_border","button_background_color","button_text_color","botton_text","postion","gif_show","redirect_style")->where('links_id', $links_id)->first();
    }

    public static function createDefalutLinksListsStyles($links_id)
    {
        return self::insert(["links_id"=>$links_id,"logo"=>"https://nilife.oss-cn-beijing.aliyuncs.com/wepage/20210421-180054-178.png"]);
    }

    public static function createLinksListsStyles($paramas)
    {
        return self::insert($paramas);
    }

    public static function updateLinksListsStyles($links_id,$paramas)
    {
        return self::where('links_id', $links_id)->update($paramas);
    }

    public static function updateLinksStyle($links_id,$style)
    {
        return self::where('links_id', $links_id)->update(["style"=>$style]);
    }

    public static function updateLinksRedirectStyle($links_id,$redirect_style)
    {
        return self::where('links_id', $links_id)->update(["redirect_style"=>$redirect_style]);
    }

}
